cfg = {
    "基础功能": {
        "数据下载": {
            "function": "download_oss_images",
            "script": "functions/detectParser.py",
            "introduce": "下载Excel中URL链接的数据。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "xls_src",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "Excel路径*"
                },
                {
                    "arg": "sheet",
                    "dtype": "str",
                    "name": "Sheet表名"
                },
                {
                    "arg": "table",
                    "dtype": "str",
                    "default": "original_image",
                    "name": "URL列名*"
                },
                {
                    "arg": "rename",
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "重命名"
                },
                {
                    "arg": "prefix",
                    "dtype": "str",
                    "default": "",
                    "name": "重命名前缀"
                },
                {
                    "arg": "worker",
                    "dtype": "str",
                    "combobox": "{'index': 0, 'params':['thread'], 'items':['多线程']}",
                    "name": "下载模式"
                },
                {
                    "arg": "num_workers",
                    "dtype": "int",
                    "default": "8",
                    "name": "并行下载数量"
                },
                {
                    "arg": "img_dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "保存路径*"
                }
            ]
        },                
        "翻转修正(A)": {
            "function": "check_unmatch_imgs_between_cv_pil",
            "script": "functions/washer.py",
            "introduce": "\u68c0\u67e5\u62cd\u7167\u56fe\u7247\u662f\u5426\u7ffb\u8f6c90\u00b0\uff08PIL\u548cCV\u8bfb\u53d6\u7684\u5bbd\u9ad8\u662f\u5426\u4e0d\u4e00\u81f4\uff09\u5e76\u4fee\u590d\u3002",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "\u8f93\u5165\u6570\u636e\u96c6\u8def\u5f84*"
                }
            ]
        },        
        "图片命名(R)": {
            "function": "rename_dataset",
            "script": "functions/washer.py",
            "introduce": "\u7ed9\u5b9a\u524d\u7f00\u91cd\u547d\u540d\u6570\u636e\u96c6\uff0c\u9879\u76ee\u7c7b\u522b_\u8d1f\u8d23\u4eba\u540d\u5b57\u7f29\u5199_\u65f6\u95f4\uff08\u4f1a\u81ea\u52a8\u5728\u540e\u9762\u8ffd\u52a0\u751f\u6210\u65f6\u95f4\uff09\uff0c\u5982ty_ljj_20210121\u3002\u5982\u679c\u6570\u636e\u96c6\u4e2d\u5305\u542bJson\u6587\u4ef6\uff0c\u5219\u4f1a\u540c\u65f6\u66f4\u65b0Json\u4e2d\u56fe\u7247\u8def\u5f84\u4fe1\u606f\u3002",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入数据集路径*"
                },
                {
                    "arg": "prefix",
                    "dtype": "str",
                    "name": "图片命名关键字*"
                },
                {
                    "arg": "shuffle",
                    "dtype": "bool",
                    "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "打乱顺序"
                }
            ]
        },        
        "图片裁剪(C)": {
            "function": "crop_from_mask",
            "script": "functions/checkMask.py",
            "introduce": "\u5c06\u5df2\u6807\u6ce8\u597dlabelme\u56fe\u7247\u4e2d\u7684SKU\u6309\u540d\u79f0\u5b58\u50a8\u5165\u76f8\u5e94\u7684\u6587\u4ef6\u5939\uff0c\u4ee5\u4fbf\u6570\u636e\u68c0\u67e5\uff0c\u6700\u540e\u652f\u6301\u91cd\u65b0 \u751f\u6210Json\u6807\u6ce8\u3002",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入数据集路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "SKU保存路径"
                },
                {
                    "arg": "exp_rate",
                    "dtype": "float",
                    "name": "裁剪框扩大率",
               					"default": 0.2
                }
            ]
        },
        "生成标注(G)": {
            "function": "gen_mask_from_crop",
            "script": "functions/checkMask.py",
            "introduce": "\u5728\u5b8c\u6210SKU\u6587\u4ef6\u5939\u68c0\u67e5\u7ea0\u9519\u4e4b\u540e\uff0c\u91cd\u65b0\u751f\u6210Json\u6587\u4ef6\u3002",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "cropsrc",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "SKU文件夹路径*"
                },
                {
                    "arg": "imgsrc",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "原图片路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "新标注保存路径"
                }
            ]
        },            
        "收集SKU(S)": {
            "function": "collect_images_with_multi_labels",
            "script": "functions/wahser.py",
            "introduce": "收集cut文件夹目录下，单张图片中含两个以上SKU的所有框。",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "文件夹路径*"
            }
            ]
        },
        "查找图片(F)": {
            "function": "collect_images_with_label",
            "script": "functions/check.py",
            "introduce": "查找包含指定SKU名称的所有图片，并复制至指定位置（默认为同级目录下的新文件夹）。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "数据集路径*"
                },
                {
                    "arg": "label",
                    "dtype": "str",
                    "name": "SKU名称*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "保存路径"
                }
            ]
        },
        "检查标签(J)": {
            "function": "check_cuts_and_zb_labels",
            "script": "functions/washer.py",
            "introduce": "将总表标签复制到本地txt，检查cuts目录下的文件夹是否在总表中存在。",
            "addSeparator": "True",
            "configs": [{
                "arg": "cutspath",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "cuts文件夹路径*"
            },
                {
                "arg": "zbtxt",
                "dtype": "str",
                "openFileDialog": "file",  # "directory", "file",
                "name": "总表标签txt*"
            },
            ]
        },
        "合并标注": {
            "function": "mergeShapeWithoutOverlap",
            "script": "functions/mergeShapeWithoutOverlap.py",
            "introduce": "合并mask数据集标注框，并去除重叠框（优先保留原数据集标注，其次合并入新数据集标注）。",
            "configs": [
                {
                    "arg": "src1",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "原数据集标注*"
                },
                {
                    "arg": "src2",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "新数据集标注*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "合并保存路径*"
                },{
                "arg": "mode",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['standard', 'minimum'], 'items':['IOU分母为并集', 'IOU分母为最小']}",
                "name": "IOU模式"
            },
                {
                    "arg": "iouThr",
                    "dtype": "float",
                    "default": "0.6",
                    "name": "iouThr"
                }
            ]
        },
        "修改标签": {
            "function": "rename_maskset",
            "script": "function/rename.py",
            "introduce": "修改mask数据SKU标签名称。",
            "addSeparator": "True",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",
                "name": "mask数据集*"
            }, {
                "arg": "spec",
                "dtype": "str",
                "name": "标签映射为"
            }, {
                "arg": "txt",
                "dtype": "str",
                "openFileDialog": "file",
                "name": "标签映射txt"
            }
            ]
        },       
        "过滤背景框": {
            "function": "run_keep_main_ann",
            "script": "functions/keep_shapes_inside_spec_contour.py",
            "introduce": "根据主场景mask框，将主场景外的全部背景SKU删除掉。",
            "addSeparator": "True",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "输入数据*"
            },
            {
                "arg": "iou_mode",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['minimum', 'standard'], 'items':['最小分母', '标准分母']}",
                "name": "IOU计算模式*"
            },            
            {
                "arg": "iou_thr",
                "dtype": "float",
                "default": "0.5", 
                "name": "IOU阈值*"
            },   
            {
                "arg": "spec",
                "dtype": "str",
                "default": "cj",
                "name": "主场景框编码*"
            },   
            {
                "arg": "dst",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存路径*"
            },                                       
            ]
        },
        "绘画标注框": {
            "function": "plot_mask",
            "script": "functions/plot_mask.py",
            "addSeparator": "True",
            "introduce": "在图片上绘画出json标注框。",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "mask数据路径*"
            }, {
                "arg": "mode",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['rectangle', 'contour', 'mask'], 'items':['矩形', '轮廓', '掩码']}",
                "name": "模式"
            },{
                "arg": "alpha",
                "dtype": "float",
                "default": "1",  
                "name": "mask透明度"
            },{
                "arg": "label_text",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['upper', 'lower'], 'items':['上', '下']}",
                "name": "标签位置"
            },{
                "arg": "dst",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存路径*"
            },
            ]
        },                    
    },
    "数据统计": {       
        "逐张统计框数": {
            "function": "countPerImg",
            "script": "functions/skuCount.py",
            "introduce": "统计每张图片的标注框数量。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "数据集路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "递归遍历*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "file",  # "file", "file",
                    "name": "统计结果保存*"
                },
            ]
        },
        "数据集框数(T)": {
            "function": "skuCountV2",
            "script": "functions/skuCount.py",
            "introduce": "\u7edf\u8ba1labelme\u6807\u6ce8\u6570\u636e\u96c6\u7684\u56fe\u7247\u6570\u3001SKU\u7c7b\u522b\u6570\u548c\u603b\u6846\u6570\u3002",
            "addSeparator": "True",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "数据集路径*"
            },
            {
                "arg": 'mode',
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['pair', 'json', 'cuts'], 'items':['图片对', '纯json', '裁剪图']}",
                "name": "数据集模式"
            },
            {
                "arg": 'recursive',
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "递归遍历"
            },
            {
                "arg": 'dst',
                "dtype": "str",
                "name": "保存路径"
            }    
            ]
        },     
        "统计框数-表格附图": {
            "function": "countPic2XLS",
            "script": "functions/skuCount.py",
            "introduce": "输入cuts文件夹，自动生成映射表（需手动将excel表格图片全部嵌入为单元格图片）。",
            "configs": [
                {
                    "arg": "cuts",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入cuts路径*"
                },
                {
                    "arg": "xlsx",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "映射表保存路径"
                }
            ]
        },       
    },
    "数据增强": {
        "盒子拍照矫正": {
            "function": "rectify_fridge_images",
            "script": "functions/aiotUtils.py",
            "introduce": "AIOT冰箱鱼眼摄像头拍照会产生畸变，手动拍照的图片需要矫正处理。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "图片路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "保存路径"
                }
            ]
        },        
        "Gamma增强": {
            "function": "adjust_gamma_images",
            "script": "functions/aiotUtils.py",
            "introduce": "对图片进行Gamma亮度调整。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "图片路径*"
                },
                {
                    "arg": "minvalue",
                    "dtype": "int",
                    "default": "0",
                    "name": "最低亮度"
                },
                {
                    "arg": "maxvalue",
                    "dtype": "int",
                    "default": "211",
                    "name": "最高亮度"
                },
                {
                    "arg": "gamma",
                    "dtype": "float",
                    "default": "1.9",
                    "name": "γ值*"
                }
            ]
        },
        "图片Resize": {
            "function": "resize_dataset",
            "script": "functions/washer.py",
            "introduce": "压缩（resize）图片长宽，支持同时压缩mask标注。",
            "addSeparator": "True",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "数据集路径*"
            },
                {
                "arg": 'with_bbox',
                "dtype": "bool",
                "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "Resize Mask"
            },
                {
                "arg": 'limit',
                "dtype": "int",
                "default": "1333",
                "name": "图片最大长边"
            },
                {
                "arg": 'dst',
                "dtype": "str",
                "default": "",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存路径"
            }
            ]
        },       
        "Mosaic Bbox": {
            "function": "createMosaicAffineData",
            "script": "functions/mosaic_bbox.py",
            "introduce": "随机4张图片拼接生成新标注图片，bbox版。",
            "configs": [{
                "arg": "srcpath",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "数据集路径*"
            },
                {
                "arg": 'scalethr',
                "dtype": "float",
                "default": "1.2",
                "name": "scalethr"
            },
                {
                "arg": 'affine_prob',
                "dtype": "float",
                "default": "0.2",
                "name": "affine_prob"
            },
                {
                "arg": 'areathr',
                "dtype": "float",
                "default": "0.4",
                "name": "areathr"
            },
                {
                "arg": 'rotate_degree',
                "dtype": "float",
                "default": "10",
                "name": "rotate_degree"
            }, {               
                 "arg": "destpath",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "结果保存*"
            },            
            ]
        },       
        "Mosaic Mask": {
            "function": "createMosaicAffineDataMask",
            "script": "functions/mosaic_mask.py",
            "introduce": "随机4张图片拼接生成新标注图片，mask版。",
            "addSeparator": "True",
            "configs": [{ # data_root, save_root, mosaic_size=800, mosaic_prob=1, affine_prob=0, degree=15, scale=1, rm_thr=0.5
                "arg": "data_root",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "数据集路径*"
            },
                {
                "arg": 'mosaic_size',
                "dtype": "int",
                "default": "800",
                "name": "mosaic_size"
            },
                {
                "arg": 'mosaic_prob',
                "dtype": "float",
                "default": "1.0",
                "name": "mosaic_prob"
            },
                {
                "arg": 'affine_prob',
                "dtype": "float",
                "default": "0.0",
                "name": "affine_prob"
            },
                {
                "arg": 'degree',
                "dtype": "float",
                "default": "15",
                "name": "degree"
            },
                {
                "arg": 'scale',
                "dtype": "float",
                "default": "1.0",
                "name": "scale"
            },
                {
                "arg": 'rm_thr',
                "dtype": "float",
                "default": "0.5",
                "name": "rm_thr"
            },
                {
                "arg": 'save_root',
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "结果保存*"
            }
            ]
        },                        
    },
    "数据集工具": {
        "mask训前检查": {
            "function": "checkWrongMasks",
            "script": "functions/check.py",
            "addSeparator": "True",
            "introduce": "检查并过滤json数据集噪点[点、线、越界]标注mask。",
            "configs": [{
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "json数据集路径*"
            }
            ]
        },        
        "mask转coco": {
            "function": "labelme2coco",
            "script": "functions/labelme2coco.py",
            "introduce": "输入labelme标注好的文件夹，生成coco格式的数据集。",
            "configs": [
                {
                    "arg": "input_dir",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "mask标注数据*"
                },
                {
                    "arg": "copy_img",
                    "dtype": "bool",
                    "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "是否拷贝图像"
                },
                {
                    "arg": "instance",
                    "dtype": "bool",
                    "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "实例分割数据"
                },
                {
                    "arg": "cover_dir",
                    "dtype": "bool",
                    "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "删除已存在目录"
                },                
                {
                    "arg": "output_dir",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "coco数据保存*"
                },                
                {
                    "arg": "label",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "default": "",
                    "name": "数据集标签"
                },
            ]
        },
        "coco转mask": {
            "function": "coco2labelme_main",
            "script": "functions/coco2labelme.py",
            "introduce": "输入coco数据json，转换成labelme格式的数据。",
            "configs": [
                {
                    "arg": "annpath",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "coco数据集json*"
                },
                {
                    "arg": "savepath",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "labelme标注保存*"
                }
            ]
        },
        "bbox转mask": {
            "function": "bbox2mask",
            "script": "functions/box2mask.py",
            "introduce": "将bbox（xml）数据转换成mask（json）数据（默认在xml同目录下生成）。",
            "configs": [
                {
                    "arg": "input_path",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入xml数据路径*"
                },
                {
                    "arg": "output_path",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输出json数据路径"
                }
            ]
        },
        "mask转bbox": {
            "function": "mask2bbox",
            "script": "functions/mask2bbox.py",
            "introduce": "将mask（json）数据转换成bbox（xml）数据。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入json数据路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输出xml数据路径"
                }
            ]
        },
        "实例转语义": {
            "function": "instance2semantic",
            "script": "functions/instance2semantic.py",
            "introduce": "实例分割转语义分割。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入路径*"
                },      
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "保存路径*"
                }                
            ]
        },
        "语义转实例": {
            "function": "semantic2instance",
            "script": "functions/semantic2instance.py",
            "introduce": "语义分割转实例分割。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "输入路径*"
                },      
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "保存路径*"
                }            
            ]
        },      
       "boxInfo转labelme": {
            "function": "boxInfoListToLabelMe",
            "script": "functions/detectParser.py",
            "introduce": "将运营系统识别结果Json转成labelme格式（需将图片和json放同一目录）。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "数据路径*"
                },
                {
                    "arg": "keepLayer", 
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "保留层数*"
                },
                {
                    "arg": "keepDaiding", # keepDaiding
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "保留待定框*"
                }
            ]
        },
        "labelme转boxInfo": {
            "function": "labelme2bboxInfo",
            "script": "functions/detectParser.py",
            "introduce": "将labelme格式数据转成运营系统识别结果Json（需将图片和json放同一目录）。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "数据路径*"
                }
            ]
        },        
        "采样分类数据": {
            "function": "sample_dataset",
            "script": "functions/gen_train_test.py",
            "introduce": "从cuts文件夹下随机采样出训练或测试集，可以指定每类的最大数量。",
            "configs": [
                {
                    "arg": "cutsrc",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "cuts文件夹路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "采样保存路径*"
                },
                {
                    "arg": "maxNumPerCls",
                    "dtype": "int",
                    "default": "1000",
                    "name": "每类最多框数量"
                }
            ]
        },
        "采样检测数据": {
            "function": "sample_det_dataset",
            "script": "functions/gen_train_test.py",
            "introduce": "从输入文件夹中随机采样出一定数量的图片，作为测试集。",
            "configs": [
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "数据集路径*"
                },
                {
                    "arg": "dst",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "采样结果保存*"
                },
                {
                    "arg": "ann_type",
                    "dtype": "str",
                    "combobox": "{'index': 0, 'params':['json', 'xml']}",
                    "name": "标注数据格式"
                },
                {
                    "arg": "ntest",
                    "dtype": "int",
                    "default": "300",
                    "name": "采样数量"
                }
            ]
        }
    },
    "超级模型": {
        "查询库": { #count_db(ip, port, userName=userName, route=route, save=save)
            "function": "count_db",
            "script": "functions/super_model_apis.py",
            "introduce": "查询指纹库和显存SKU数据。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },                
                {
                    "arg": "userName",
                    "dtype": "str",
                    "default": "",
                    "name": "用户库名"
                },                
                {
                    "arg": "route",
                    "dtype": "str",
                    "default": "10104",
                    "name": "用户库路由"
                },                
                {
                    "arg": "save",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "查询结果保存",
                }
            ]
        },
        "删除库": { # delete_db(ip, port, userName, route, labels=None)
            "function": "delete_db",
            "script": "functions/super_model_apis.py",
            "introduce": "删除未学习本地H5库中指定路由下的指纹。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "用户库名*"
                },
                {
                    "arg": "route",
                    "dtype": "str",
                    "default": "10104",
                    "name": "用户库路由"
                }
            ]
        },
        "特征入库": {# insert_db(ip, port, userName, route, src, batch_size=256)
            "function": "insert_db",
            "script": "functions/super_model_apis.py",
            "introduce": "即时更新SKU新品入特征库，每款SKU新品建议标注至少10个框再入库（尽量保证每个框都具备多样性）。更新完成后即可使用自动打标服务进行打标。",
            "addSeparator": "True",
            "configs": [
                {
                "arg": "ip",
                "dtype": "str",
                "default": "http://192.168.11.25",
                "name": "服务器地址*"
            }, 
            {
                "arg": "port",
                "dtype": "str",
                "default": "9998",
                "name": "端口"
            },      
            {
                "arg": "userName",
                "dtype": "str",
                "name": "用户库名*"
            },            
            {
                "arg": "route",
                "dtype": "str",
                "default": "10104",
                "name": "用户库路由*"
            },            
            {
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "入库图片路径"
            },
            {
                "arg": "batch_size",
                "dtype": "int",
                "default": "256",
                "name": "批传输大小"
            }
            ]
        },
        "加载库": { # load_index_ul(ip, port, userName, route)
            "function": "load_index_ul",
            "script": "functions/super_model_apis.py",
            "introduce": "加载特征库到内存/显存中，只有加载之后才能进行指纹识别。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "用户库名*"
                },
                {
                    "arg": "route",
                    "dtype": "str",
                    "default": "10104",
                    "name": "用户库路由*"
                }
            ]
        },
        "释放缓存": { # empty_udb_cache(ip, port, userName=None)
            "function": "empty_udb_cache",
            "script": "functions/super_model_apis.py",
            "addSeparator": "True",
            "introduce": "主动释放缓存，打标结束后，如无需再使用，请主动释放缓存。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "用户库名*"
                }
            ]
        },        
        "商品识别": {
                # imdetect(ip, port, src, save, recursive=False, mode='skuDet', tenantId='10104', 
                #         userName=None, route='10104', lthr=0.5, ltopk=5, uthr=0.5, utopk=5, 
                #         filter_daiding=False, with_score=True, empty=True, only_main=True, keep_labels=None,):            
            "function": "imdetect",
            "script": "functions/super_model_apis.py",
            "introduce": "给定检测服务端口地址、检测路由和特征索引路由，即可对给定的图片集进行打标，输出标注为Json格式。支持在线调整阈值和topk参数。",
            "addSeparator": "True",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },
                {
                    "arg": "mode",
                    "dtype": "str",
                    "combobox": "{'index': 1, 'params':['layerDet', 'skuDet']}",
                    "name": "识别路由*"
                },                
            {
                "arg": "tenantId",
                "dtype": "str",
                "default": "10104",
                "name": "租户ID*"
            },                
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "用户库名"
                },
                {
                    "arg": "route",
                    "dtype": "str",
                    "name": "用户库路由"
                },                
            {
                "arg": "ltopk",
                "dtype": "int",
                "default": "5",
                "name": "ltopk"
            },
            {
                "arg": "utopk",
                "dtype": "int",
                "default": "5",
                "name": "utopk"
            },
            {
                "arg": "lthr",
                "dtype": "float",
                "default": '1',
                "name": "lthr"
            },
            {
                "arg": "uthr",
                "dtype": "float",
                "default": '0.3',
                "name": "uthr"
            },
            {
                "arg": "filter_daiding",
                "dtype": "bool",
                "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "是否过滤待定框"
            },
            {
                "arg": "with_score",
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "是否保留分数"
            },
            {
                "arg": "empty",
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "识别空位"
            },
            {
                "arg": "only_main",
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "只识别主场景"
            },                      
            {
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "输入图片路径*"
            },
             {
                "arg": "keep_labels",
                "dtype": "str",
                "openFileDialog": "file",  # "directory", "file",
                "name": "待识别类别"
            },                      
            {
                "arg": "recursive",
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "递归遍历图片*"
            },            
             {
                "arg": "save",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存识别结果*"
            },             
            ]
        },        
        # search_similar_images(ip, port, src, save, score=0.5, topk=5, 
        # batch_size=256, learned_matcher=True, userName=None, route='10104'): 
        "检索相似类别": {
            "function": "search_similar_images",
            "script": "functions/super_model_apis.py",
            "introduce": "在库中检索是否存在相似SKU，返回生成EXCEL。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },       
                {
                    "arg": "learned_matcher",
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "检索已学习库"
                },       
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "检索用户库"
                },       
                {
                    "arg": "route",
                    "dtype": "str",
                    "default": "10104",
                    "name": "用户库路由"
                },                                                       
                {
                    "arg": "score",
                    "dtype": "float",
                    "default": "0.3",
                    "name": "相似度阈值*"
                },            
                {
                    "arg": "topk",
                    "dtype": "int",
                    "default": "5",
                    "name": "topk*"
                },            
                {
                    "arg": "batch_size",
                    "dtype": "int",
                    "default": "256",
                    "name": "批处理大小*"
                },                                                                     
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "待检索图片路径"
                },
                {
                    "arg": "save",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "检索结果保存"
                }                
            ]
        },       
        "小图检索归类": {
            "function": "cluster_similar_images",
            "script": "functions/super_model_apis.py",
            "addSeparator": "True",
            "introduce": "与库中的图片特征进行匹配，并重新归类本地图片。",
            "configs": [
                {
                    "arg": "ip",
                    "dtype": "str",
                    "default": "http://192.168.11.25",
                    "name": "服务器地址*"
                },
                {
                    "arg": "port",
                    "dtype": "str",
                    "default": "9998",
                    "name": "端口*"
                },       
                {
                    "arg": "learned_matcher",
                    "dtype": "bool",
                    "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                    "name": "检索已学习库"
                },       
                {
                    "arg": "userName",
                    "dtype": "str",
                    "name": "检索用户库"
                },       
                {
                    "arg": "route",
                    "dtype": "str",
                    "default": "10104",
                    "name": "用户库路由"
                },                                                       
                {
                    "arg": "score",
                    "dtype": "float",
                    "default": "0.3",
                    "name": "相似度阈值*"
                },            
                {
                    "arg": "topk",
                    "dtype": "int",
                    "default": "5",
                    "name": "topk*"
                },            
                {
                    "arg": "batch_size",
                    "dtype": "int",
                    "default": "256",
                    "name": "批处理大小*"
                },                                                                     
                {
                    "arg": "src",
                    "dtype": "str",
                    "openFileDialog": "directory",  # "directory", "file",
                    "name": "待检索图片路径*"
                },
                {
                    "arg": "save",
                    "dtype": "str",
                    "openFileDialog": "file",  # "directory", "file",
                    "name": "检索结果保存*"
                }                
            ]
        },                 
        "评估识别率": {
            "function": "evaluate_api",
            "script": "functions/detect_evaluate.py",
            "introduce": "对比人工标注和模型预测的labelme标注文件，评估得出查全率、查准率指标。",
            "configs": [{ # gtsrc, detsrc, save_dir=None, classes=None, iou_thr=0.5, mode='bbox', iou_mode='standard'
                "arg": "gtsrc",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "人工标注数据*"
            }, {
                "arg": "detsrc",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "模型推理数据*"
            }, {
                "arg": "classes",
                "dtype": "str",
                "openFileDialog": "file",  # "directory", "file",
                "name": "数据集类别txt"
            }, {
                "arg": "mode",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['bbox', 'mask'], 'items':['矩形iou', '多边形iou']}",
                "name": "iou评估标准"
            }, {
                "arg": "iou_mode",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['standard', 'minimum'], 'items':['分母为并集', '分母为最小面积']}",
                "name": "iou计算模式"
            }, {
                "arg": "iou_thr",
                "dtype": "float",
                "default": "0.5",  
                "name": "iou阈值"
            }, {
                "arg": "save_dir",
                "dtype": "str",
                "openFileDialog": "file",  # "directory", "file",
                "name": "保存结果xlsx"
            }
            ]
        },
        "筛选误识别": {
            "function": "vision_wrong_instances",
            "script": "functions/accuracy_mask.py",
            "introduce": "结合人工标注数据和模型推理结果，筛选出误检、漏检和多检的标签。",
            "addSeparator": "True",
            "configs": [{
                "arg": "gtsrc",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "人工标注数据*"
            }, {
                "arg": "ptsrc",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "模型推理数据*"
            }, {
                "arg": "dst",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存筛选结果"
            }
            ]
        },            
    },
    "识别服务箱": {
        "Retail4.0识别": {
            "function": "testHttp",
            "script": "functions/testService.py",
            "introduce": "常规sku和（或）场景分层识别服务。",
            "addSeparator": "True",
            "configs": [
                {
                "arg": "url",
                "dtype": "str",
                "default": "http://192.168.11.25:9090/detService",
                "name": "检测服务地址"
            },
            {
                "arg": "tenantId",
                "dtype": "str",
                "default": "10104",
                "name": "待识别租户ID"
            },
            {
                "arg": "detRoute",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['layerDet', 'skuDet']}",
                "name": "识别服务类型"
            },
            {
                "arg": "src",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "输入文件夹路径*"
            }, {
                "arg": "dst",
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "保存打标路径*"
            }, 
            {
                "arg": "filter_daiding",
                "dtype": "bool",
                "combobox": "{'index': 1, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "是否过滤待定框"
                    },
                {
                "arg": "with_score",
                "dtype": "bool",
                "combobox": "{'index': 0, 'params':['False', 'True'], 'items':['否', '是']}",
                "name": "是否保留分数"
                    }
            ]
        },    
        "mm2.x微识别": {
            "function": "detect_local_images",
            "script": "functions/object_detect_client.py",
            "introduce": "mmdetection2.x模型推理服务（bbox、mask），无后处理高效实现版。",
            "addSeparator": "True",
            "configs": [{
                    "arg": "url",
                    "dtype": "str",
                    "default": "http://192.168.11.25:9998/object_detect",
                    "name": "检测服务地址*"
                }, {
                    "arg": "model_name",
                    "dtype": "str",
                    "name": "模型名字*"
                }, {
                    "arg": "mode",
                    "dtype": "str",
                    "combobox": "{'index': 0, 'params':['segm', 'bbox'], 'items':['mask', 'bbox']}",
                    "name": "标注类型"
                }, {
                    "arg": "score_thr",
                    "dtype": "float",
                    "default": "0.5",
                    "name": "置信度"
                }, {
                    "arg": "batch_size",
                    "dtype": "int",
                    "default": "1",
                    "name": "batch_size"
                }, 
            {
                "arg": "worker",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['thread'], 'items':['多线程']}",
                "name": "并行模式",
            },
            {
                "arg": "num_workers",
                "dtype": "int",
                "default": "8",
                "name": "并行数量",
            },
            {
                "arg": "src", 
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "图片路径*",
            },             
            {
                "arg": "dst", 
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "结果保存*",
            },         
            ],            
        },
        "图片质量检测": {
            "function": "detect_imgs_qua_ass",
            "script": "functions/imgQuaAss.py",
            "introduce": "根据指标筛选出质量合格的图片。",
            "addSeparator": "True",
            "configs": [ # url, src, dst, worker='process', num_workers=8, 
            # sizeDegree=1, blurDegree=1, yawDegree=1, brightnessDegree=1, recaptureDegree=1, nondisplayDegree=1
                {
                "arg": "url",
                "dtype": "str",
                "default": "http://172.16.73.202:9999/imgQuaAss",
                "name": "图片质量检测接口*"
            },
            {
                "arg": "sizeDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '长边小于200', '正常', '长边大于2048']}",
                "name": "图像尺寸度",
            },
            {
                "arg": "blurDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '轻度模糊', '正常', '模糊']}",
                "name": "图像模糊度",
            },
            {
                "arg": "yawDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '轻度倾斜', '正常', '倾斜']}",
                "name": "图像倾斜度",
            },           
            {
                "arg": "brightnessDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '过亮', '正常', '过暗']}",
                "name": "图像亮度",
            },           
            {
                "arg": "recaptureDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '疑似翻盘', '正常', '翻拍']}",
                "name": "图像翻拍度",
            },           
            {
                "arg": "nondisplayDegree", 
                "dtype": "int",
                "combobox": "{'index': 0, 'params':['-1', '0', '1', '2'], 'items':['不选', '疑似陈列照', '正常', '非陈列照']}",
                "name": "非陈列照度",
            },
            {
                "arg": "worker",
                "dtype": "str",
                "combobox": "{'index': 0, 'params':['thread'], 'items':['多线程']}",
                "name": "并行模式",
            },
            {
                "arg": "num_workers",
                "dtype": "int",
                "default": "8",
                "name": "并行数量",
            },
            {
                "arg": "src", 
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "图片路径*",
            },             
            {
                "arg": "dst", 
                "dtype": "str",
                "openFileDialog": "directory",  # "directory", "file",
                "name": "结果保存*",
            },         
            ],
        },       
    }
}
